home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Herra / TIMWIN.ZIP / LABEL&.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-22  |  1KB  |  48 lines

  1. ;label&  --  labeling images having more than 255 objects
  2. ;            Add your analysis to this command file
  3. ;expects:    binary source image in a
  4. ;destroys:   p, q
  5. ;result:     in q
  6. ;
  7. int numobj 
  8. int ready = 0
  9. int seq = 0
  10. int nn
  11. int total = 0
  12.  
  13. dis p
  14.  
  15. repeat
  16.   seq += 1
  17.   numobj = label a        ;if more than 255 labels rpar is negative
  18.   copy p q                ;save labeled image part to 'q'
  19.   thre 1                  ;make labeled image part in 'p' binary
  20.   xor p a >a              ;remove labeled part from source
  21.   if numobj < 0           ;if negative:
  22.     print "Sequence ", seq
  23.     numobj *= -1          ;make numobj positive for analysis
  24.   else
  25.     print "Last sequence ..."
  26.     ready = 1 ;           ;if positive this is last sequence
  27.   endif
  28.   ;
  29.   ;here goes the image analysis of the labeled image in 'q'
  30.    call analysis
  31.   ;
  32. until ready == 1          ;as long as not ready label image
  33. print "----------------------------------------------"
  34. print "Total:" @20 total "objects analyzed"
  35. stop
  36.  
  37.  
  38. analysis:                 ;simple object processing
  39.   dis q
  40.   mark 1 0                ;first object separate to learn position
  41.   for nn = 2 to numobj step 1   
  42.     mark nn 0 /           ;further objects by incremental search (/)
  43.   endfor
  44.   print @20 numobj "objects analyzed"
  45.   total += numobj
  46.   dis p
  47.   return
  48.